#pragma once
#include<iostream>
using namespace std;
class Stack {
public:
	Stack(int n=4);
	~Stack();
	void Push(int a);
	void Pop();
	int Size();
	bool Empty();
private:
	void CheckCapacity() {
		if (_top == _capacity) {
			int newcapacity = _capacity * 2;
			int* temp = (int*)realloc(_array,sizeof(int*) * newcapacity);
			_array = temp;
			_capacity = newcapacity;
		}
	}
	int* _array;
	int _top;
	int _capacity;
};

